package com.cvmars.jianyou.module.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.cvmars.jianyou.R;
import com.cvmars.jianyou.config.MyConfig;
import com.cvmars.jianyou.model.UserModel;
import com.cvmars.jianyou.ui.CircleImageView;
import com.cvmars.jianyou.utils.ImageUtils;
import com.orhanobut.hawk.Hawk;

import butterknife.BindView;
import butterknife.ButterKnife;

public class XiangQinDetailActivity extends AppCompatActivity {

    @BindView(R.id.txt_dating)
    TextView txtDating;
    @BindView(R.id.iv_avator)
    CircleImageView ivAvator;
    @BindView(R.id.txt_name)
    TextView txtName;
    @BindView(R.id.iv_sex)
    ImageView ivSex;
    @BindView(R.id.txt_address)
    TextView txtAddress;
    @BindView(R.id.txt_age)
    TextView txtAge;
    @BindView(R.id.txt_address_company)
    TextView txtAddressCompany;
    @BindView(R.id.txt_intro)
    TextView txtIntro;
    @BindView(R.id.ed_content)
    TextView edContent;
    @BindView(R.id.parent_layout)
    LinearLayout parentLayout;
    @BindView(R.id.txt_subject)
    Button txtSubject;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xiang_qin_detail);
        ButterKnife.bind(this);


       final   UserModel model = (UserModel) getIntent().getSerializableExtra("user");

        ImageUtils.loadImage(this, model.avatar_url, ivAvator);

        txtName.setText(model.name);
        txtAddress.setText(model.address_home);
        txtAge.setText(model.age);
        txtIntro.setText(model.intro);
        edContent.setText(model.expect_desc);
        txtAddressCompany.setText(model.address_company);
        ivSex.setImageResource(model.gender == 1 ? R.drawable.ic_male : R.drawable.ic_women);

        txtSubject.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(XiangQinDetailActivity.this,
                        PersonHomeActivity.class);
                intent.putExtra("userid", model.id);
                startActivity(intent);
            }
        });
    }
}
